package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # Apache 2.0

load(
    "//mace:mace.bzl",
    "if_apu_enabled",
    "if_hexagon_enabled",
    "if_hta_enabled",
    "if_opencl_enabled",
    "if_quantize_enabled",
    "if_rpcmem_enabled",
)

cc_library(
    name = "opencl_headers",
    hdrs = glob([
        "opencl/*.h",
    ]),
    copts = [
        "-Werror",
        "-Wextra",
        "-Wno-missing-field-initializers",
    ],
    deps = [
        "@opencl_clhpp",
        "@opencl_headers//:opencl20_headers",
    ],
)

cc_library(
    name = "runtimes",
    srcs = glob([
        "*.cc",
    ]),
    hdrs = glob([
        "*.h",
    ]),
    copts = [
        "-Werror",
        "-Wextra",
        "-Wno-missing-field-initializers",
    ] + if_opencl_enabled([
        "-DMACE_ENABLE_OPENCL",
    ]) + if_quantize_enabled([
        "-DMACE_ENABLE_QUANTIZE",
    ]) + if_hexagon_enabled([
        "-DMACE_ENABLE_HEXAGON",
    ]) + if_hta_enabled([
        "-DMACE_ENABLE_HTA",
    ]) + if_apu_enabled([
        "-DMACE_ENABLE_MTK_APU",
    ]) + if_rpcmem_enabled([
        "-DMACE_ENABLE_RPCMEM",
    ]),
    linkopts = ["-ldl"],
    deps = [
        "//mace/runtimes/cpu:cpu_runtimes",
        "//mace/runtimes/hexagon:hexagon_runtimes",
    ] + if_opencl_enabled([
        "//mace/runtimes/opencl:opencl_runtimes",
        "opencl_headers",
    ]) + if_apu_enabled([
        "//mace/runtimes/apu:apu_runtimes",
    ]),
)
